﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using UnityEngine.UI;
using UnityEngine;
using Assets.Scripts.TDuResource;
using Assets.Scripts.TDu3DWork;

namespace Assets.Scripts.TDuVRUI
{

    //提示窗口，没用了暂时
    class TDuTipTextDashboard
    {
        public GameObject m_dialogPanel;

        public TDuTipTextDashboard()
        {
            m_dialogPanel = null;
        }
        public void updateUI(VariableNode curVarNode, GameObject parent)
        {
            Debug.Log("更新了tipText");
            //对话框Dialog生成
            //DefaultControls.Resources panel_uiResources = new DefaultControls.Resources();
            m_dialogPanel = parent.transform.Find("TipTextPanel").gameObject;
            m_dialogPanel.SetActive(true);
            parent.SetActive(true);
            GameObject tipText = m_dialogPanel.transform.Find("TipTextWnd").gameObject;
            tipText.GetComponent<Text>().text = curVarNode.strAnimateObj;

        }
        //public void create(VariableNode curVarNode, GameObject parent)
        //{
        //    //对话框Dialog生成
        //    DefaultControls.Resources panel_uiResources = new DefaultControls.Resources();
        //    m_dialogPanel = DefaultControls.CreatePanel(panel_uiResources);
        //    m_dialogPanel.name = "DialogPanel";
        //    m_dialogPanel.transform.SetParent(parent.transform, false);
        //    m_dialogPanel.GetComponent<RectTransform>().localScale = new Vector3(0.5f, 0.5f, 0.5f);
        //    m_dialogPanel.GetComponent<Image>().color = Color.gray;
        //    m_dialogPanel.SetActive(false);

        //    DefaultControls.Resources dialogtext_uiResources = new DefaultControls.Resources();
        //    GameObject dialogText = DefaultControls.CreateText(dialogtext_uiResources);
        //    dialogText.transform.SetParent(m_dialogPanel.transform, false);
        //    dialogText.GetComponent<RectTransform>().sizeDelta = new Vector2(800F, 400F);
        //    dialogText.name = "DialogTextWnd";
        //    dialogText.GetComponent<Text>().fontSize = 40;
        //    dialogText.GetComponent<Text>().color = Color.black;
        //    dialogText.GetComponent<Text>().text = curVarNode.strAnimateObj;
        //    dialogText.GetComponent<Text>().alignment = TextAnchor.MiddleCenter;

        //    DefaultControls.Resources Ok_uiResources = new DefaultControls.Resources();
        //    GameObject Ok_uiButton = DefaultControls.CreateButton(Ok_uiResources);
        //    Ok_uiButton.transform.SetParent(m_dialogPanel.transform, false);
        //    Ok_uiButton.GetComponent<RectTransform>().sizeDelta = new Vector2(200F, 60F);
        //    Ok_uiButton.GetComponent<RectTransform>().anchorMin = new Vector2(0.5F, 0.5F);
        //    Ok_uiButton.GetComponent<RectTransform>().anchorMax = new Vector2(0.5F, 0.5F);
        //    Ok_uiButton.transform.localPosition = new Vector3(0, -240, 0);
        //    Ok_uiButton.transform.Find("Text").GetComponent<Text>().GetComponent<Text>().color = Color.black;
        //    Ok_uiButton.transform.Find("Text").GetComponent<Text>().GetComponent<Text>().text = "确定";
        //    Ok_uiButton.transform.Find("Text").GetComponent<Text>().GetComponent<Text>().fontSize = 40;

        //    Ok_uiButton.GetComponent<Button>().onClick.AddListener(
        //                () =>
        //                {
        //                    hidePanel();
        //                }
        //            );
        //}

        public void hidePanel()
        {
            m_dialogPanel.SetActive(false);
        }
    }
}
